#include "Animation.h"

Animation::Animation(IDirect3DTexture9* texture)
	: texture(texture)
{
   frameTime = 1.0f / 20.0f;
   isLooping = true;
   D3DSURFACE_DESC desc;
   texture->GetLevelDesc(0, &desc);
   startFrame = 0;
   endFrame = desc.Width / desc.Height;
   frameCount = endFrame - startFrame;
   frameWidth = desc.Height;
   frameHeight = desc.Height;
}

Animation::Animation(IDirect3DTexture9* texture, float frameTime, bool isLooping)
	: texture(texture), frameTime(frameTime), isLooping(isLooping)
{
	D3DSURFACE_DESC desc;
	texture->GetLevelDesc(0, &desc);
	startFrame = 0;
	endFrame = desc.Width / desc.Height;
	frameCount = endFrame - startFrame;
	frameWidth = desc.Height;
	frameHeight = desc.Height;
}

Animation::Animation(IDirect3DTexture9* texture, float frameTime, bool isLooping, int startFrame, int endFrame, int frameWidht, int frameHeight)
	: texture(texture),
	frameTime(frameTime),
	isLooping(isLooping),
	startFrame(startFrame),
	endFrame(endFrame),
	frameWidth(frameWidth),
	frameHeight(frameHeight)
{
   frameCount = endFrame - startFrame;
}